<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Hammerspoon docs: ArrangeDesktop</title>
    <style type="text/css">
      a { text-decoration: none; }
      a:hover { text-decoration: underline; }
      th { background-color: #DDDDDD; vertical-align: top; padding: 3px; }
      td { width: 100%; background-color: #EEEEEE; vertical-align: top; padding: 3px; }
      table { width: 100% ; border: 1px solid #0; text-align: left; }
      section > table table td { width: 0; }
    </style>
    <link rel="stylesheet" href="docs.css" type="text/css" media="screen" />
  </head>
  <body>
    <header>
      <h1><a href="./index.html">docs</a> &raquo; ArrangeDesktop</h1>
      <p>Easily create, save, and use desktop arrangements.</p>
<p>Positioning logic adapted from https://github.com/dploeger/hammerspoon-window-manager</p>

      </header>
      <h3>API Overview</h3>
      <ul>
        <li>Variables - Configurable values</li>
          <ul>
            <li><a href="#arrangements">arrangements</a></li>
            <li><a href="#configFile">configFile</a></li>
            <li><a href="#logger">logger</a></li>
          </ul>
        <li>Functions - API calls offered directly by the extension</li>
          <ul>
            <li><a href="#_buildArrangement">_buildArrangement</a></li>
            <li><a href="#_loadConfiguration">_loadConfiguration</a></li>
            <li><a href="#_positionApp">_positionApp</a></li>
            <li><a href="#_writeConfiguration">_writeConfiguration</a></li>
          </ul>
        <li>Methods - API calls which can only be made on an object returned by a constructor</li>
          <ul>
            <li><a href="#addMenuItems">addMenuItems</a></li>
            <li><a href="#arrange">arrange</a></li>
            <li><a href="#createArrangement">createArrangement</a></li>
          </ul>
      </ul>
      <h3>API Documentation</h3>
        <h4 class="documentation-section">Variables</h4>
          <section id="arrangements">
            <a name="//apple_ref/cpp/Variable/arrangements" class="dashAnchor"></a>
            <h5><a href="#arrangements">arrangements</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop.arrangements</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Contains the configured desktop arrangements</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L21">Source/ArrangeDesktop.spoon/init.lua line 21</a></td>
              </tr>
            </table>
          </section>
          <section id="configFile">
            <a name="//apple_ref/cpp/Variable/configFile" class="dashAnchor"></a>
            <h5><a href="#configFile">configFile</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop.configFile</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Defines where the config file is stored. Defaults to hs.spoons.scriptPath()/config.json</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L26">Source/ArrangeDesktop.spoon/init.lua line 26</a></td>
              </tr>
            </table>
          </section>
          <section id="logger">
            <a name="//apple_ref/cpp/Variable/logger" class="dashAnchor"></a>
            <h5><a href="#logger">logger</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop.logger</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L16">Source/ArrangeDesktop.spoon/init.lua line 16</a></td>
              </tr>
            </table>
          </section>
        <h4 class="documentation-section">Functions</h4>
          <section id="_buildArrangement">
            <a name="//apple_ref/cpp/Function/_buildArrangement" class="dashAnchor"></a>
            <h5><a href="#_buildArrangement">_buildArrangement</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop._buildArrangement() -&gt; table</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Function</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Builds the configuration for the current desktop arrangement.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>A table containing the configuration data for the current desktop arrangement</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L72">Source/ArrangeDesktop.spoon/init.lua line 72</a></td>
              </tr>
            </table>
          </section>
          <section id="_loadConfiguration">
            <a name="//apple_ref/cpp/Function/_loadConfiguration" class="dashAnchor"></a>
            <h5><a href="#_loadConfiguration">_loadConfiguration</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop._loadConfiguration() -&gt; table or nil</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Function</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Loads the configuration file.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>A table containing the configured desktop arrangements, or nil if an error occurred</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L31">Source/ArrangeDesktop.spoon/init.lua line 31</a></td>
              </tr>
            </table>
          </section>
          <section id="_positionApp">
            <a name="//apple_ref/cpp/Function/_positionApp" class="dashAnchor"></a>
            <h5><a href="#_positionApp">_positionApp</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop._positionApp(app, appTitle, screen, frame)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Function</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Positions all windows for an application based on the given configuration.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>app - A table of the application instance</li>
<li>appTitle - The name of the application, e.g., Slack, Firefox, etc.</li>
<li>screen - A table of the position of the screen (x, y integer pair) to place the application window into</li>
<li>frame - A table of the frame details for the application window, e.g., {w=12, h=12, x=12, y=12}</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L113">Source/ArrangeDesktop.spoon/init.lua line 113</a></td>
              </tr>
            </table>
          </section>
          <section id="_writeConfiguration">
            <a name="//apple_ref/cpp/Function/_writeConfiguration" class="dashAnchor"></a>
            <h5><a href="#_writeConfiguration">_writeConfiguration</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop._writeConfiguration(config) -&gt; bool</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Function</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Writes the configuration to a file.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>config - A table containing the configuration to write</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>A boolean indicating if the write was successful</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L59">Source/ArrangeDesktop.spoon/init.lua line 59</a></td>
              </tr>
            </table>
          </section>
        <h4 class="documentation-section">Methods</h4>
          <section id="addMenuItems">
            <a name="//apple_ref/cpp/Method/addMenuItems" class="dashAnchor"></a>
            <h5><a href="#addMenuItems">addMenuItems</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop:addMenuItems(menuItems) -&gt; table</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Add menu items to a table for each configured desktop arrangement.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>menuItems - A table of menu items to append to</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>A table of menu items</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L154">Source/ArrangeDesktop.spoon/init.lua line 154</a></td>
              </tr>
            </table>
          </section>
          <section id="arrange">
            <a name="//apple_ref/cpp/Method/arrange" class="dashAnchor"></a>
            <h5><a href="#arrange">arrange</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop:arrange(arrangement)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Arrange the desktop based on a given configuration</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>arrangement - A table of arrangement data</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L135">Source/ArrangeDesktop.spoon/init.lua line 135</a></td>
              </tr>
            </table>
          </section>
          <section id="createArrangement">
            <a name="//apple_ref/cpp/Method/createArrangement" class="dashAnchor"></a>
            <h5><a href="#createArrangement">createArrangement</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>ArrangeDesktop:createArrangement()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Creates the desktop arrangement and saves it to the configuration file.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/ArrangeDesktop.spoon/init.lua#L186">Source/ArrangeDesktop.spoon/init.lua line 186</a></td>
              </tr>
            </table>
          </section>
  </body>
</html>